//
//  AFNGetDataValue.m
//  FoodFamily
//
//  Created by Bang-guo on 15-6-19.
//  Copyright (c) 2015年 guoBang. All rights reserved.
//

#import "AFNGetDataValue.h"

@implementation AFNGetDataValue

+(void)getDataAFN:(NSString *)urlStr block:(getDataValueBlock)getBlock {
    
    AFNetworkReachabilityManager *netWorkManager = [AFNetworkReachabilityManager sharedManager];
    
    NSString *url_string = [NSString stringWithFormat:@"%@", urlStr];
    
    
    //[NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"text/html",nil];  代表支持所有的接口类型
    
    AFHTTPRequestOperationManager* manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"text/html",nil];
    [manager GET:url_string parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        [netWorkManager stopMonitoring];
//        NSLog(@"使用AFN进行get请求 ===  %@",responseObject);
        getBlock(responseObject);
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        NSLog(@"失败==== %@",error);
        getBlock(nil);
        
    }];

    
    
    
    
    

}


@end
